import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";

export const useShare = () => {
  onShareAppMessage((res) => {
    console.log(res);
    return {
      title: "明日餐食",
      path: "/pages/menu/selected",
      imageUrl: "/static/images/food.png",
    };
  });

  onShareTimeline((res) => {
    return {
      title: "这是朋友圈的",
      summary: "这是分享的内容",
      success: (res) => {
        console.log(res);
      },
      fail: (error) => {
        console.log(error);
      },
    };
  });

  return {
    onShareAppMessage,
    onShareTimeline,
  };
};
